<!DOCTYPE html>
<html lang="zh-CN">    
  <head>
      <meta charset="utf-8">
      <title>
          Easy_Score_System
      </title>     
  </head>
  <body bgcolor="#CAFFFF">

    <div class="box" style="float:left;width:100%;">
      <div style="width:50%; float:left;">
      <h2>CRUSADE出血评分系统</h2>
      <b>性别</b>
      <input type="radio" name="性别" id="男" value="0">男
      <input type="radio" name="性别" id="女" value="8">女
      <br>
      <br>
      <b>心衰体征</b>
      <input type="radio" name="心衰" id="有" value="7">有
      <input type="radio" name="心衰" id="无" value="0">无
      <br>
      <br>
      <b>糖尿病</b>
      <input type="radio" name="糖尿病" id="是" value="6">是
      <input type="radio" name="糖尿病" id="否" value="0">否
      <br>
      <br>
      <b>血管疾病或卒中病史</b>
      <input type="radio" name="血管疾病" id="是" value="6">是
      <input type="radio" name="血管疾病" id="否" value="0">否
      <br>
      <br>
      <b>心率(次/min)</b><input type="text" id="gtj_input4" class="text1" placeholder="请输入">
      <br>
      <br>
      <b>收缩压(mmHg)</b><input type="text" id="gtj_input2" class="text1" placeholder="请输入">
      <br>
      <br>
      <b>基线血细胞比容(%)</b><input type="text" id="gtj_input" class="text1" placeholder="请输入">
      <br>
      <br>     
      <b>肌酐清除率(ml/min)</b><input type="text" id="gtj_input3" class="text1" placeholder="请输入">
      <br>
      <br>
      <b>总分</b><input type="text" id="gtj_output" class="text2" >
      <b>分组</b><input type="text" id="gtj_output2" class="text2" >
      <br>
      <br>
      <button class="button1" onclick = 'calculator()'><b>计算</b></button> 
      <button class="button2" onclick="clere()"><b>清零</b></button>
      </div>

      <div style="width:50%; float:left;">
      <h2>GRACE危险评分系统</h2>
      <b>年龄(岁)</b><input type="text" id="gtj" class="text1" placeholder="请输入">
      <br>
      <br> 
      <b>心率(次/min)</b><input type="text" id="gtj2" class="text1" placeholder="请输入">
      <br>
      <br>
      <b>收缩压(mmHg)</b><input type="text" id="gtj3" class="text1" placeholder="请输入">
      <br>
      <br>
      <b>CK(umol/L)</b><input type="text" id="gtj4" class="text1" placeholder="请输入">
      <br>
      <br>
      <b>Killip分级</b>
      <input type="radio" name="Killip分级" id="Ⅰ" value="0">Ⅰ级
      <input type="radio" name="Killip分级" id="Ⅱ" value="20">Ⅱ级
      <input type="radio" name="Killip分级" id="Ⅲ" value="39">Ⅲ级
      <input type="radio" name="Killip分级" id="Ⅳ" value="59">Ⅳ级
      <br>
      <br>
      <b>院前心跳棸停</b>
      <input type="radio" name="心跳棸停" id="有" value="39">有
      <input type="radio" name="心跳棸停" id="无" value="0">无
      <br>
      <br>
      <b>心肌损伤标志物升高</b>
      <input type="radio" name="心肌损伤" id="是" value="14">是
      <input type="radio" name="心肌损伤" id="否" value="0">否
      <br>
      <br>
      <b>ST段下移</b>
      <input type="radio" name="ST段下移" id="是" value="28">是
      <input type="radio" name="ST段下移" id="否" value="0">否
      <br>
      <br>
      <b>总分</b><input type="text" id="output" class="text2" >
      <b>分组</b><input type="text" id="output2" class="text2" >
      <br>
      <br>
      <button class="button1" onclick = 'calculator2()'><b>计算</b></button> 
      <button class="button2" onclick="clere2()"><b>清零</b></button>
      </div>
    </div>


    <br>
    <br>
    
    <script>
     function calculator(){

      var input = document.getElementById("gtj_input").value
      input = parseFloat(input)
      if (input < parseFloat(31)) {
        input = 9
      } else if (parseFloat(31) <= input & input <= parseFloat(33.9)) {
        input = 7
      } else if (parseFloat(34) <= input & input <= parseFloat(36.9)) {
        input = 3
      } else if (parseFloat(37) <= input & input <= parseFloat(39.9)) {
        input = 2
      } else if (parseFloat(40) <= input) {
        input = 0
      }

      var input2 = document.getElementById("gtj_input2").value
      input2 = parseFloat(input2)
      if (input2 <= parseFloat(90)) {
        input2 = 10
      } else if (parseFloat(91) <= input2 & input2 <= parseFloat(100)) {
        input2 = 8
      } else if (parseFloat(101) <= input2 & input2 <= parseFloat(120)) {
        input2 = 5
      } else if (parseFloat(121) <= input2 & input2 <= parseFloat(180)) {
        input2 = 1
      } else if (parseFloat(181) <= input2 & input2 <= parseFloat(200)) {
        input2 = 3
      } else if (parseFloat(201) <= input2) {
        input2 = 5
      }

      var input3 = document.getElementById("gtj_input3").value
      input3 = parseFloat(input3)
      if (input3 <= parseFloat(15)){
        input3 = 39
      } else if (parseFloat(15) < input3 & input3 <= parseFloat(30)){
        input3 = 35
      } else if (parseFloat(30) < input3 & input3 <= parseFloat(60)){
        input3 = 28
      } else if (parseFloat(60) < input3 & input3 <= parseFloat(90)){
        input3 = 17
      } else if (parseFloat(90) < input3 & input3 <= parseFloat(120)){
        input3 = 7
      } else if (parseFloat(120) < input3){
        input3 = 0
      }
      
      var input4 = document.getElementById("gtj_input4").value;
      input4 = parseFloat(input4)
      if (input4 <= parseFloat(70)) {
        input4 = 0
      } else if (parseFloat(71) <= input4 & input4 <= parseFloat(80)) {
        input4 = 1
      } else if (parseFloat(81) <= input4 & input4 <= parseFloat(90)) {
        input4 = 3
      } else if (parseFloat(91) <= input4 & input4 <= parseFloat(100)) {
        input4 = 6
      } else if (parseFloat(101) <= input4 & input4 <= parseFloat(110)) {
        input4 = 8
      } else if (parseFloat(111) <= input4 & input4 <= parseFloat(120)) {
        input4 = 10
      } else if (parseFloat(121) <= input4) {
        input4 = 11
      }

      var sexs=document.getElementsByName("性别"); 
      for(var x=0;x<sexs.length;x++){ 
      if(sexs[x].checked){ 
      var sex = parseInt(sexs[x].value)
      } }
 
      var hearts=document.getElementsByName("心衰"); 
      for(var x=0;x<hearts.length;x++){ 
      if(hearts[x].checked){ 
      var heart = parseInt(hearts[x].value)
      } }

      var DMs=document.getElementsByName("糖尿病"); 
      for(var x=0;x<DMs.length;x++){ 
      if(DMs[x].checked){ 
      var DM = parseInt(DMs[x].value)
      } }

      var vessels=document.getElementsByName("血管疾病"); 
      for(var x=0;x<vessels.length;x++){ 
      if(vessels[x].checked){ 
      var vessel = parseInt(vessels[x].value)
      } }
      
      var output = parseInt(input) + 
                   parseInt(input2) + 
                   parseInt(input3) + 
                   parseInt(input4) + 
                   parseInt(sex) + 
                   parseInt(heart) + 
                   parseInt(DM) + 
                   parseInt(vessel)
        
      document.getElementById('gtj_output').value = output

      var grade
      if (output <= parseInt(20)){
        grade = "极低危组"
      } else if (parseInt(21)<=output&output<=parseInt(30)){
        grade = "低危组"
      } else if (parseInt(31)<=output&output<=parseInt(40)){
        grade = "中危组"
      } else if (parseInt(41)<=output&output<=parseInt(50)){
        grade = "高危组"
      } else if (parseInt(50)<output){
        grade = "极高危组"
      }

      document.getElementById('gtj_output2').value = grade

     }

     function clere(){
      document.getElementById("gtj_input").value = ""
      document.getElementById("gtj_input2").value = ""
      document.getElementById("gtj_input3").value = ""
      document.getElementById("gtj_input4").value = ""
      document.getElementById('gtj_output').value = ""
      document.getElementById('gtj_output2').value = ""

      var sexs=document.getElementsByName("性别"); 
      for(var x=0;x<sexs.length;x++){ 
      if(sexs[x].checked){ 
      sexs[x].checked = false
      } }
 
      var hearts=document.getElementsByName("心衰"); 
      for(var x=0;x<hearts.length;x++){ 
      if(hearts[x].checked){ 
        hearts[x].checked = false
      } }

      var DMs=document.getElementsByName("糖尿病"); 
      for(var x=0;x<DMs.length;x++){ 
      if(DMs[x].checked){ 
        DMs[x].checked = false
      } }

      var vessels=document.getElementsByName("血管疾病"); 
      for(var x=0;x<vessels.length;x++){ 
      if(vessels[x].checked){ 
        vessels[x].checked = false
      } }
     }

     //函数2
     function calculator2(){

var input11 = document.getElementById("gtj").value
input11 = parseFloat(input11)
if (input11 < parseFloat(30)) {
  input11 = 0
} else if (parseFloat(30) <= input11 & input11 <= parseFloat(39)) {
  input11 = 8
} else if (parseFloat(40) <= input11 & input11 <= parseFloat(49)) {
  input11 = 25
} else if (parseFloat(50) <= input11 & input11 <= parseFloat(59)) {
  input11 = 41
} else if (parseFloat(60) <= input11 & input11 <= parseFloat(69)) {
  input11 = 58
} else if (parseFloat(70) <= input11 & input11 <= parseFloat(79)) {
  input11 = 75
} else if (parseFloat(80) <= input11) {
  input11 = 91
}

var input22 = document.getElementById("gtj2").value
input22 = parseFloat(input22)
if (input22 < parseFloat(50)) {
  input22 = 0
} else if (parseFloat(50) <= input22 & input22 <= parseFloat(69)) {
  input22 = 3
} else if (parseFloat(70) <= input22 & input22 <= parseFloat(89)) {
  input22 = 9
} else if (parseFloat(90) <= input22 & input22 <= parseFloat(109)) {
  input22 = 15
} else if (parseFloat(110) <= input22 & input22 <= parseFloat(149)) {
  input22 = 24
} else if (parseFloat(150) <= input22 & input22 <= parseFloat(199)) {
  input22 = 38
} else if (parseFloat(200) <= input22) {
  input22 = 46
}

var input33 = document.getElementById("gtj3").value
input33 = parseFloat(input33)
if (input33 < parseFloat(80)){
  input33 = 58
} else if (parseFloat(80) <= input33 & input33 <= parseFloat(99)){
  input33 = 53
} else if (parseFloat(100) <= input33 & input33 <= parseFloat(119)){
  input33 = 43
} else if (parseFloat(120) <= input33 & input33 <= parseFloat(139)){
  input33 = 34
} else if (parseFloat(140) <= input33 & input33 <= parseFloat(159)){
  input33 = 24
} else if (parseFloat(160) <= input33 & input33 <= parseFloat(199)){
  input33 = 10
} else if (parseFloat(200) <= input33){
  input33 = 0
}

var input44 = document.getElementById("gtj4").value;
input44 = parseFloat(input44)
if (input44 <= parseFloat(34)) {
  input44 = 1
} else if (parseFloat(35) <= input44 & input44 <= parseFloat(69)) {
  input44 = 4
} else if (parseFloat(70) <= input44 & input44 <= parseFloat(104)) {
  input44 = 7
} else if (parseFloat(105) <= input44 & input44 <= parseFloat(139)) {
  input44 = 10
} else if (parseFloat(140) <= input44 & input44 <= parseFloat(174)) {
  input44 = 13
} else if (parseFloat(175) <= input44 & input44 <= parseFloat(349)) {
  input44 = 21
} else if (parseFloat(350) <= input44) {
  input44 = 28
}

var killips=document.getElementsByName("Killip分级"); 
for(var x=0;x<killips.length;x++){ 
if(killips[x].checked){ 
var killip = parseInt(killips[x].value)
} }

var stops=document.getElementsByName("心跳棸停"); 
for(var x=0;x<stops.length;x++){ 
if(stops[x].checked){ 
var stop = parseInt(stops[x].value)
} }

var hurts=document.getElementsByName("心肌损伤"); 
for(var x=0;x<hurts.length;x++){ 
if(hurts[x].checked){ 
var hurt = parseInt(hurts[x].value)
} }

var STs=document.getElementsByName("ST段下移"); 
for(var x=0;x<STs.length;x++){ 
if(STs[x].checked){ 
var ST = parseInt(STs[x].value)
} }

var output2 = parseInt(input11) + 
             parseInt(input22) + 
             parseInt(input33) + 
             parseInt(input44) + 
             parseInt(killip) + 
             parseInt(stop) + 
             parseInt(hurt) + 
             parseInt(ST)
  
document.getElementById('output').value = output2

var grade2
if (output2 <= parseInt(99)){
  grade2 = "低危组"
} else if (parseInt(100)<=output2&output2<=parseInt(200)){
  grade2 = "高危组"
} else if (parseInt(200)<output2){
  grade2 = "极高危组"
}

document.getElementById('output2').value = grade2

}

function clere2(){
document.getElementById("gtj").value = ""
document.getElementById("gtj2").value = ""
document.getElementById("gtj3").value = ""
document.getElementById("gtj4").value = ""
document.getElementById('output').value = ""
document.getElementById('output2').value = ""

var killips=document.getElementsByName("Killip分级"); 
for(var x=0;x<killips.length;x++){ 
if(killips[x].checked){ 
killips[x].checked = false
} }

var stops=document.getElementsByName("心跳棸停"); 
for(var x=0;x<stops.length;x++){ 
if(stops[x].checked){ 
  stops[x].checked = false
} }

var hurts=document.getElementsByName("心肌损伤"); 
for(var x=0;x<hurts.length;x++){ 
if(hurts[x].checked){ 
  hurts[x].checked = false
} }

var STs=document.getElementsByName("ST段下移"); 
for(var x=0;x<STs.length;x++){ 
if(STs[x].checked){ 
  STs[x].checked = false
} }
} 
    </script>
  </body>
</html>
